﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
//using Kaskelot.SP.UI.Analys.Domain;
using System.ServiceModel;
using Kaskelot.SP.UI.Analys.Data.AnalyseService;

namespace Kaskelot.SP.UI.Analys.Data
{
    public class WCFHelper
    {

        public static ClientAnalysServiceClient GetServiceFactory(Uri url)
        {
            ClientAnalysServiceClient client = new ClientAnalysServiceClient(GetBinding(url.Scheme == "https"), new EndpointAddress(url));
            return client;
        }

        private static System.ServiceModel.Channels.Binding GetBinding(bool https = false)
        {
            BasicHttpSecurityMode mode = https ? BasicHttpSecurityMode.Transport : BasicHttpSecurityMode.TransportCredentialOnly;
            BasicHttpBinding binding = new BasicHttpBinding(mode);
            binding.MaxReceivedMessageSize = int.MaxValue;
            return binding;
        }
    }
}
